<%
var headerPart = {
%>
<style>
	html{background-color: #fff!important;}
</style>
<% }; %>
<% layout("/layouts/micro.html",{headerSection:headerPart}){ %>
	<div class="childrenBody">
	<div class="layui-tab-content">
	<form id="inputForm" action="${ctx}/cms/link/save" method="post" class="layui-form">
		<input type="hidden" name="id" value="${link.id}"/>
		<#message content="${message!}"/>
		<div class="layui-form-item">
			<label class="layui-form-label">归属栏目:</label>
			<div class="layui-input-inline">
				<#treeselect id="category" name="category.id" value="${link.category.id!}" labelName="category.name" labelValue="${link.category.name!}"
					title="栏目" url="/cms/category/treeData" module="link" selectScopeModule="true" notAllowSelectRoot="false" notAllowSelectParent="true" cssClass="required"/>
			</div>
			<div class="layui-form-mid "><font color="red">*</font> </div>
		</div>	
		
		<div class="layui-form-item">
			<label class="layui-form-label">名称:</label>
			<div class="layui-input-inline">
				<input type="text" name="title" value="${link.title}" htmlEscape="false" maxlength="200" class="layui-input measure-input" lay-verify="required"/>
			</div>
			<div class="layui-form-mid "><font color="red">*</font> </div>
			<label class="layui-form-label">颜色:</label>
			<div class="layui-input-inline">
				<select name="color" class="input-mini">
					<option value="" label="默认"/>
					<#options items="${@DictUtils.getDictList('color')}" value="${link.color}" />
				</select>
			</div>	
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">链接图片:</label>
			<div class="layui-input-inline">
				<input type="hidden" id="image" name="image" value="${link.image}" />
				<#ckfinder input="image" type="images" uploadPath="/cms/link" selectMultiple="false" readonly="false"/>
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">链接地址:</label>
			<div class="layui-input-block"><!-- class="input-xxlarge" -->
				<input type="text" name="href" value="${link.href}" htmlEscape="false" maxlength="255" class="layui-input"/>
			</div>
		</div>
		
		<div class="layui-row layui-col-space15 layui-form-item">
			<div class="layui-col-md3">
				<label class="layui-form-label">权重:</label>
				<div class="layui-input-block">
					<input id="weight" type="text" name="weight" value="${link.weight}" htmlEscape="false" maxlength="200" class="layui-input digits" lay-verify="required"/>&nbsp;
				</div>
			</div>
			<div class="layui-col-md3">
				<label class="layui-form-label"></label>
				<div class="layui-input-block">
					<label for="weightTop" class="layui-form-label" >置顶:</label>
					<input lay-skin="primary"  id="weightTop" type="checkbox" lay-filter="weightTop">
					<script type="text/javascript">
		            	layui.use(['form'],function(){
		            		var form  = layui.form;
		            		form.on('checkbox(weightTop)', function(data){
		            			$('#weight').val(this.checked?'999':'0')
		           			});  
		            	})
            		</script>
				</div>
			</div>
			<div class="layui-col-md3">
				<label class="layui-form-label">过期时间：</label>
				<div class="layui-input-block">
					<input id="weightDate" name="weightDate" type="text" readonly="readonly" maxlength="20" class="layui-input"
					value="${link.weightDate!,dateFormat='yyyy-MM-dd'}"/>
				<!-- <span class="help-inline">数值越大排序越靠前，过期时间可为空，过期后取消置顶。</span> -->
					<script>
                        layui.use(['form','laydate'], function() {
                            var form = layui.form, laydate = layui.laydate;
                            laydate.render({
                                elem: "#weightDate",
                                value: '${link.weightDate,dateFormat="yyyy-MM-dd"}'
                            });
                        })
					</script>
				</div>
				
			</div>
			<div class="layui-col-md3">
				<div class="layui-word-aux">数值越大排序越靠前，过期时间可为空，过期后取消置顶。</div>
			</div>
		</div>
	
		<div class="layui-form-item">
			<label class="layui-form-label">备注:</label>
			<div class="layui-input-block">
				<textarea name="remarks" htmlEscape="false" rows="4" maxlength="200" class="layui-textarea">${link.remarks}</textarea>
			</div>
		</div>
		
		<%if(shiro.hasPermission("cms:article:audit")){%>
		<div class="layui-input-inline">
			<label class="layui-form-label">状态</label>
			<div class="layui-input-inline">
				<#radio name="delFlag" items="${@DictUtils.getDictList('cms_del_flag')}" value="${link.delFlag}"/>
			</div>
		</div>
		<%}%>
	
		<div class="layui-form-item layui-hide">
	    	<div class="layui-input-block">
      			<button class="layui-btn" lay-filter="*" id="linkForm" lay-submit>保 存</button>
	       		<button type="reset" class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
		    </div>
	  	</div>
	</form>
	</div>
</div>
<%}%>